package com.yg.poseavatar;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class MyDrawView extends View {

    private Paint paint;
    public float x=0;
    public float y=0;

    public float[] pts = new float[34];



    public MyDrawView(Context context, AttributeSet attrs) {
        super(context, attrs);
        paint = new Paint();
        paint.setAntiAlias(true);
        paint.setStrokeWidth(30);
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.GREEN);
    }

    public MyDrawView(Context context) {
        super(context);
    }

    public MyDrawView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setPoint(float x, float y)
    {
        this.x = x;
        this.y = y;
        postInvalidate();
    }

    public void setPoints(float pts[])
    {
        this.pts = pts;

        postInvalidate();
    }



    @Override
    protected void onDraw(Canvas canvas) {
//        canvas.drawPoint(x,y,paint);
        canvas.drawPoints(pts,paint);
//        postInvalidateDelayed(40);
    }
}
